Skip to content

fix(gemma4): Restore KV sharing for the Gemma 4 assistants and their targets - #50531

Open
harshaljanjani wants to merge 1 commit into
huggingface:mainfrom
harshaljanjani:fix/gemma4-assistant-kv-sharing
Open

harshaljanjani wants to merge 1 commit into
huggingface:mainfrom
harshaljanjani:fix/gemma4-assistant-kv-sharing

Conversation

@harshaljanjani

@harshaljanjani harshaljanjani commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🤗 Transformers CI

What does this PR do?

→ Fixes #50316
→ Assistants (all layers shared) now reuse every layer, and targets with num_kv_shared_layers=0 store the last layer of each type again as before #47290; a non-skipped tiny-config test_assisted_decoding_matches_greedy_search covers both for Gemma 4 and Gemma 4 Unified.

cc: @qgallouedec @remi-or @Cyrilvallez

Code Agent Policy

  • AI assistance was used, but this is not a pure code-agent PR or PR description.

Before submitting

Signed-off-by: Harshal Janjani <harshaljanjani@gmail.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: gemma4, gemma4_assistant, gemma4_unified, gemma4_unified_assistant

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM, checked myself, cc @remi-or @Cyrilvallez for the merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Gemma 4 assistant models fail to build since KV sharing was formalized

2 participants